(define (path n bst)
    (path-aux `() n bst)
)

(define (path-aux lst n bst)
    (cond
        [(null? bst) `error]
        [(eqv? (car bst) n) lst]
        [(> n (car bst))
            (path-aux 
                (append lst `(rigth)) n (caddr bst))
        ]
        [else
            (path-aux 
                (append lst `(left)) n (cadr bst))
        ]
    )
)

(display
    (path 
        17 
        `(
            14 
            (
                7 
                () 
                (12 () ())
            )
            (
                26 
                (
                    20
                    (17 () ())
                    ()
                )
                (31 () ())
            )
        )
    )
)
